<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="utf-8" />
		<title>邮件配置</title>
		<meta name="viewport" content="width=device-width, initial-scale=1.0" />
		<include file="common/tag"/>
	</head>

	<style>
		body{
			background-color:#fff;
		}
		.yui_right{
			float: right;
			margin-bottom: 20px;
		}
		.yui_email{
			width: 60%;
			height: 100%;
			margin-top: 20px;
			margin-left: 20%;
		}
		.yui_save{
			margin-bottom: 50px;
		}
	</style>
	<body >
	<!--页面头-->
	<div class="breadcrumbs" id="breadcrumbs">
		<script type="text/javascript">
            try{ace.settings.check('breadcrumbs' , 'fixed')}catch(e){}
		</script>

		<ul class="breadcrumb">
			<li>
				<i class="icon-home home-icon"></i>
			<li class="active">邮件配置</li>
			</li>
		</ul><!-- .breadcrumb -->
	</div>

	<div class="well yui_email">
		<div class="widget-main">

			<input type="hidden" name="id" value="{$data.id}"/>
			<input type="hidden" name="__token__" value="{$Request.token}" />

			<div>
				<label >邮箱地址：</label>
				<input type="text" name="mail_address" placeholder="邮箱地址：" class="form-control" value="{$data.mail_address}"/>
			</div>

			<br>

			<div>
				<label >邮箱SMTP服务器：</label>
				<input type="text" name="mail_smtp" placeholder="邮箱SMTP服务器：" class="form-control" value="{$data.mail_smtp}"/>
			</div>

			<br>

			<div>
				<label >SMTP服务器端口：</label>
				<input type="text" name="mail_port" placeholder="SMTP服务器端口：" class="form-control" value="{$data.mail_port}"/>
			</div>

			<br>

			<div>
				<label >邮箱登录帐号：</label>
				<input type="text" name="mail_loginname"  placeholder="邮箱登录帐号：" class="form-control" value="{$data.mail_loginname}"/>
			</div>

			<br>

			<div>
				<label >邮箱密码：</label>
				<input type="password" name="mail_password" placeholder="邮箱密码：" class="form-control" value="{$data.mail_password}"/>
			</div>

			<br>

			<div>
				<label >发件人：</label>
				<input type="text" name="mail_formname" placeholder="发件人：" class="form-control" value="{$data.mail_formname}"/>
			</div>

			<br>


			<div>
				<label >状态</label>
				<select class="form-control" name="open_mail">
					<eq name="data.open_mail" value="1">
						<option value="1" selected>开启</option>
						<option value="0">关闭</option>
						<else/>
						<option value="0" selected>关闭</option>
						<option value="1">开启</option>
					</eq>
				</select>
			</div>

			<br>

			<button class="btn btn-primary yui_right" id="yui_save">
				<i class="icon-plus align-top bigger-125"></i>
				保存
			</button>
			<br>

		</div>
	</div>

	</body>

	<script>
		$(function () {
            //修改
            $("#yui_save").on('click' , function(){
                var id=$("input[name='id']").val();
                var mail_address=$("input[name='mail_address']").val();
                var mail_smtp=$("input[name='mail_smtp']").val();
                var mail_port=$("input[name='mail_port']").val();
                var mail_loginname=$("input[name='mail_loginname']").val();
                var mail_password=$("input[name='mail_password']").val();
                var mail_formname=$("input[name='mail_formname']").val();
                var open_mail=$('select[name="open_mail"]').val();
                var __token__=$("input[name='__token__']").val();
				//ajax提交数据
                $.post("/index.php/admin/config/config_email_edit",
                    {
                        id:id,
                        mail_address:mail_address,
                        mail_smtp:mail_smtp,
                        mail_port:mail_port,
                        mail_loginname:mail_loginname,
                        mail_password:mail_password,
                        mail_formname:mail_formname,
                        open_mail:open_mail,
                        __token__:__token__
                    },
                    function(data,status){
                        layer.msg(data['text']);
                	}, "json"
                );
            });

        });
	</script>

</html>
